<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <title>colorizer Docs</title>
    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">


<!-- Menu -->

<div id="navigation">
<br/>
<h1>colorizer</h1>


<ul>
  <li><a href="../index.html">Index</a></li>
</ul>

<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>


<h2>Modules</h2>
<ul class="nowrap">
  <li><a href="../modules/colorizer.html">colorizer</a></li>
  <li><a href="../modules/colorizer.buffer.html">buffer</a></li>
  <li><a href="../modules/colorizer.color.html">color</a></li>
  <li><a href="../modules/colorizer.config.html">config</a></li>
  <li><a href="../modules/colorizer.constants.html">constants</a></li>
  <li><a href="../modules/colorizer.matcher.html">matcher</a></li>
  <li><a href="../modules/colorizer.parser.rgb_hex.html">parser.rgb_hex</a></li>
  <li><a href="../modules/colorizer.parser.hsl.html">parser.hsl</a></li>
  <li><a href="../modules/colorizer.parser.names.html">parser.names</a></li>
  <li><a href="../modules/colorizer.parser.oklch.html">parser.oklch</a></li>
  <li><a href="../modules/colorizer.parser.rgb.html">parser.rgb</a></li>
  <li><a href="../modules/colorizer.parser.rgba_hex.html">parser.rgba_hex</a></li>
  <li><a href="../modules/colorizer.parser.xterm.html">parser.xterm</a></li>
  <li><a href="../modules/colorizer.sass.html">sass</a></li>
  <li><a href="../modules/colorizer.tailwind.html">tailwind</a></li>
  <li><a href="../modules/trie.html">trie</a></li>
  <li><a href="../modules/colorizer.usercmds.html">usercmds</a></li>
  <li><strong>utils</strong></li>
</ul>

</div>

<div id="content">

<h1>Module <code>colorizer.utils</code></h1>
<p>Provides utility functions for color handling and file operations.</p>
<p>
This module contains helper functions for checking byte categories, merging tables,
parsing colors, managing file watchers, and handling buffer lines.</p>


<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#rgb_to_hex">rgb_to_hex (r, g, b)</a></td>
	<td class="summary">Returns HEX format from RGB values</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#byte_is_alphanumeric">byte_is_alphanumeric (byte)</a></td>
	<td class="summary">Checks if a byte represents an alphanumeric character.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#byte_is_hex">byte_is_hex (byte)</a></td>
	<td class="summary">Checks if a byte represents a hexadecimal character.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#get_non_alphanum_keys">get_non_alphanum_keys (tbl)</a></td>
	<td class="summary">Extract non-alphanumeric characters to add as a valid index in the Trie</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#add_additional_color_chars">add_additional_color_chars (chars)</a></td>
	<td class="summary">Adds additional characters to the list of valid color characters.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#byte_is_valid_color_char">byte_is_valid_color_char (byte)</a></td>
	<td class="summary">Checks if a byte is valid as a color character (alphanumeric, dynamically added chars, or hardcoded characters).</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#count">count (str, pattern)</a></td>
	<td class="summary">Count the number of character in a string</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#get_last_modified">get_last_modified (path)</a></td>
	<td class="summary">Get last modified time of a file</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#parse_hex">parse_hex (byte)</a></td>
	<td class="summary">Parses a hexadecimal byte.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#watch_file">watch_file (path, callback, ...)</a></td>
	<td class="summary">Watch a file for changes and execute callback</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#bufme">bufme (bufnr)</a></td>
	<td class="summary">Validates and returns a buffer number.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#visible_line_range">visible_line_range (bufnr)</a></td>
	<td class="summary">Returns range of visible lines</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#hash_table">hash_table (tbl)</a></td>
	<td class="summary">Returns sha256 hash of lua table</td>
	</tr>
</table>

<br/>
<br/>


    <h2 class="section-header "><a name="Functions"></a>Functions</h2>

    <dl class="function">
    <dt>
    <a name = "rgb_to_hex"></a>
    <strong>rgb_to_hex (r, g, b)</strong>
    </dt>
    <dd>
    Returns HEX format from RGB values


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">r</span>
         number: Red value
        </li>
        <li><span class="parameter">g</span>
         number: Green value
        </li>
        <li><span class="parameter">b</span>
         number: Blue value
        </li>
    </ul>





</dd>
    <dt>
    <a name = "byte_is_alphanumeric"></a>
    <strong>byte_is_alphanumeric (byte)</strong>
    </dt>
    <dd>
    Checks if a byte represents an alphanumeric character.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">byte</span>
         number The byte to check.
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        boolean: `true` if the byte is alphanumeric, otherwise `false`.
    </ol>




</dd>
    <dt>
    <a name = "byte_is_hex"></a>
    <strong>byte_is_hex (byte)</strong>
    </dt>
    <dd>
    Checks if a byte represents a hexadecimal character.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">byte</span>
         number The byte to check.
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        boolean: `true` if the byte is hexadecimal, otherwise `false`.
    </ol>




</dd>
    <dt>
    <a name = "get_non_alphanum_keys"></a>
    <strong>get_non_alphanum_keys (tbl)</strong>
    </dt>
    <dd>
    Extract non-alphanumeric characters to add as a valid index in the Trie


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">tbl</span>
         table: The table to extract non-alphanumeric characters from.
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        string: The extracted non-alphanumeric characters.
    </ol>




</dd>
    <dt>
    <a name = "add_additional_color_chars"></a>
    <strong>add_additional_color_chars (chars)</strong>
    </dt>
    <dd>
    Adds additional characters to the list of valid color characters.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">chars</span>
         string: The additional characters to add.
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        boolean: `true` if the characters were added, otherwise `false`.
    </ol>




</dd>
    <dt>
    <a name = "byte_is_valid_color_char"></a>
    <strong>byte_is_valid_color_char (byte)</strong>
    </dt>
    <dd>
    Checks if a byte is valid as a color character (alphanumeric, dynamically added chars, or hardcoded characters).


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">byte</span>
         number: The byte to check.
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        boolean: `true` if the byte is valid, otherwise `false`.
    </ol>




</dd>
    <dt>
    <a name = "count"></a>
    <strong>count (str, pattern)</strong>
    </dt>
    <dd>
    Count the number of character in a string


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">str</span>
         string
        </li>
        <li><span class="parameter">pattern</span>
         string
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        number
    </ol>




</dd>
    <dt>
    <a name = "get_last_modified"></a>
    <strong>get_last_modified (path)</strong>
    </dt>
    <dd>
    Get last modified time of a file


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">path</span>
         string: file path
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        number|nil: modified time
    </ol>




</dd>
    <dt>
    <a name = "parse_hex"></a>
    <strong>parse_hex (byte)</strong>
    </dt>
    <dd>
    Parses a hexadecimal byte.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">byte</span>
         number The byte to parse.
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        number: The parsed hexadecimal value of the byte.
    </ol>




</dd>
    <dt>
    <a name = "watch_file"></a>
    <strong>watch_file (path, callback, ...)</strong>
    </dt>
    <dd>
    Watch a file for changes and execute callback


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">path</span>
         string: File path
        </li>
        <li><span class="parameter">callback</span>
         function: Callback to execute
        </li>
        <li><span class="parameter">...</span>
         table: params for callback
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        uv_fs_event_t|nil
    </ol>




</dd>
    <dt>
    <a name = "bufme"></a>
    <strong>bufme (bufnr)</strong>
    </dt>
    <dd>
    Validates and returns a buffer number.
 If the provided buffer number is invalid, defaults to the current buffer.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">bufnr</span>
         number|nil: The buffer number to validate.
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        number: The validated buffer number.
    </ol>




</dd>
    <dt>
    <a name = "visible_line_range"></a>
    <strong>visible_line_range (bufnr)</strong>
    </dt>
    <dd>
    Returns range of visible lines


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">bufnr</span>
         number: Buffer number
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        number, number: Start (0-index) and end (exclusive) range of lines in viewport
    </ol>




</dd>
    <dt>
    <a name = "hash_table"></a>
    <strong>hash_table (tbl)</strong>
    </dt>
    <dd>
    Returns sha256 hash of lua table


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">tbl</span>
         table: Table to be hashed
        </li>
    </ul>





</dd>
</dl>


</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated - October </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>
